function UrlSearch()
{
   var name,value;
   var str=location.href; //取得整个地址栏
   var num=str.indexOf("?")
   str=str.substr(num+1); //取得所有参数   stringvar.substr(start [, length ]

   var arr=str.split("&"); //各个参数放到数组里
   for(var i=0;i < arr.length;i++){
    num=arr[i].indexOf("=");
    if(num>0){
     name=arr[i].substring(0,num);
     value=arr[i].substr(num+1);
     this[name]=value;
     }
    }
}

function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
$(function(){
	var get = new UrlSearch();
	$('#touzi').click(function(){
		$.ajax({
		type:"get",
		url:"http://47.93.21.169/old/TP5/public/index.php/index/investhistory/investhistory",
		data:{'goods':get.goods},
		dataType:"jsonp",
		jsonp:"callback",
		success:function(msg){
var str="";
      if(msg.status==400){

      }else{
        var data = msg.data;
            if(data.length===0){
        // alert(11)
        str='暂无数据'
    }else{
        $.each(data,function(k,v){

//        $.trim()
//console.log(v); return false; 
                str +="<tr>"
                str +="<td align='left' width='25%' style='padding-left:10px; color:#4A4A4A;'>"+v.tel1+"<i class='c-tzjlicon'></i> <span class='tbline'></span> </td>"
                str +="<td style='color:#0caffe;'><span class='tbline'></span><i style='float:right; margin-right:10px;'>"+v.money+"</i></td>"
                str +="<td align='right' style='padding-right:10px;'>"+getLocalTime(v.time)+"</td>"
                str +="</tr>"
      });

               function getLocalTime(nS) {     
                  return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');     
              }
        }

      // console.log(msg)
      
      // var data = msg.data;
      // alert(msg.data)
// /
      
      $("#box").after(str);

	},
	error:function(){
		alert(4)
	}
	})
	})
})

$(document).on('click',"#ksdl",function(){
      

      	location.href='./login.html';
      
//	$.cookie('userID','111')
		

})



